#!/bin/bash
rootdir=`pwd|tr -d '\n'`

pydir=$rootdir/src/python
dataroot=$rootdir/data
iaskroot=$dataroot/iask
iaskxmldir=$iaskroot/xml
iaskpagedir=$iaskroot/page

mkdir -p $dataroot
mkdir -p $rootdir
mkdir -p $iaskxmldir

files=`ls $iaskpagedir`

for file  in ${files}
do
	cat $iaskpagedir/${file}| xargs -0 $pydir/extract.py '<div class="usr_qus">.*?<strong>(?P<question>.*?)</strong>' | xargs -0 $pydir/trimtag.py >> $iaskxmldir/${file}.xml 
	cat $iaskpagedir/${file}| xargs -0 $pydir/extract.py '<div class="pb5">(?P<answer>.*?)</div>'| xargs -0 $pydir/trimtag.py  >> $iaskxmldir/${file}.xml
done